{include file="header.tpl"}

   <h1>Dashboard</h1>

   <div id="sidebar">
      
      <div class="panel">
         <h4>Projects</h4>
         <ul id="dashboard_projects">
            {if !$projects}
            <li class="error_text">No projects found!</li>
            <li><a href="{$spf.base_url}/projects/edit/">Create a project...</a></li>
            {/if}
            {foreach item=project from=$projects}
            <li><a href="{$spf.base_url}/tickets/browse/{$project.id}">{$project.description}</a></li>
            {/foreach}
         </ul>
      </div>
      
   </div>
   
   <div id="content">
   
      {include file="flashes.tpl"}
      
      <div class="action_bar">
         <strong>Show Tickets:</strong>&nbsp;&nbsp;&nbsp;
         <a class="user{if $filter == 'assigned_me'} selected{/if}" href="{$spf.base_url}/dashboard/assigned_me">Assigned to me</a>
         <a class="user{if $filter == 'created_me'} selected{/if}" href="{$spf.base_url}/dashboard/created_me">Created by me</a>
         <a class="date{if $filter == 'created_today'} selected{/if}" href="{$spf.base_url}/dashboard/created_today">Created today</a>
         <a class="date{if $filter == 'updated_today'} selected{/if}" href="{$spf.base_url}/dashboard/updated_today">Updated today</a>
      </div>
      
      <table class="max_width">
         <thead>
            <tr class="datanav">
            	<th colspan="10">
            		{$tickets.record_count} Records
            	</th>
            </tr>
            <tr>
               <th class="center">ID</th>
               <th>Project</th>
               <th>Type</th>
               <th>Title</th>
               {if $filter != 'created_me'}<th>Created By</th>{/if}
               {if $filter != 'assigned_me'}<th>Assigned To</th>{/if}
               <th>Status</th>
               {if $filter != 'created_today'}<th>Created</th>{/if}
               <th class="center">View</th>
            </tr>
         </thead>
         <tbody>
            {foreach item=ticket from=$tickets.data}
            <tr class="{cycle values=",alt"}">
               <td class="center">{$ticket.id}</td>
               <td>{$ticket.project_desc}</td>
               <td>{$ticket.type_desc}</td>
               <td>{$ticket.title}</td>
               {if $filter != 'created_me'}<td>{$ticket.created_by}</td>{/if}
               {if $filter != 'assigned_me'}<td>{$ticket.assigned_to}</td>{/if}
               <td>{$ticket.status_desc}</td>
               {if $filter != 'created_today'}<td>{$ticket.created_date}</td>{/if}
               <td class="view"><a href="{$spf.base_url}/tickets/view/{$ticket.id}"></a></td>
            </tr>
            {/foreach}
            {if !$tickets.data}<tr><td class="norecords" colspan="10">No records found.</td></tr>{/if}
         </tbody>
      </table>

   </div>
   
{include file="footer.tpl"}
